const module1 = {
  state() {
    return {
      count: 100,
      name: "zhangsan",
      age: 30,
      likes: "sleep",
    };
  },
  mutations: {
    addCount(state, n) {
      // state.count++;
      state.count += n;
    },
    changeName(state, payload) {
      // mutations里面的函数是不允许写异步的
      // setTimeout(() => {
      state.name = payload;
      // }, 1000);
    },
  },
  actions: {
    changeName2({ commit }, payload) {
      setTimeout(() => {
        commit("changeName", payload);
      }, 1000);
    },
  },
};

export default module1;
